package com.cus.tom.transfer.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.cus.tom.transfer.App;
import com.cus.tom.transfer.R;
import com.cus.tom.transfer.frag.AppFragment;
import com.cus.tom.transfer.frag.AudioFragment;
import com.cus.tom.transfer.frag.EmptyFrag;
import com.cus.tom.transfer.frag.ImgFragment;
import com.cus.tom.transfer.frag.InfoFragment;
import com.cus.tom.transfer.frag.VideoFragment;

public class FileAdapter extends FragmentPagerAdapter {

    final String[] ss = App.getApp().getResources().getStringArray(R.array.title_record);
    int type;

    public FileAdapter(@NonNull FragmentManager fm, int type) {
        super(fm);
        this.type = type;
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        switch (position) {
            case 0:
                return new ImgFragment(1, position);
            case 1:
                return new VideoFragment(1, position);
            case 2:
                return new AudioFragment(1, position);
            case 3:
                return new AppFragment(1, position);
            case 4:
                return new InfoFragment(1, position);
            default:
                return new EmptyFrag();
        }
    }

    @Override
    public int getCount() {
        return ss.length;
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return ss[position];
    }
}
